import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getSessionStorage(){
  return JSON.parse(sessionStorage.getItem("user"));
}

export function setSessionStorage(user){
  // return this.$cache.session.setJSON("user", { user })
  return sessionStorage.setItem("user", JSON.stringify(user));
}

export function removeSessionStorage(){
  // return this.$cache.session.remove('user');
  return sessionStorage.removeItem("user");
}


export function getStudentRoleStorage(){
  return JSON.parse(sessionStorage.getItem("StudentRole"));
}

export function setStudentRoleStorage(row){
  // return this.$cache.session.setJSON("user", { user })
  return sessionStorage.setItem("StudentRole", JSON.stringify(row));
}

export function removeStudentRoleStorage(){
  return sessionStorage.removeItem("StudentRole");
}